package cn.gailvlun.gll.util;

import android.content.Context;
import android.os.Build;

import com.blankj.utilcode.util.LogUtils;

import java.util.UUID;

import static android.content.ContentValues.TAG;



public class DeviceUtil {
    
    public static String getLocaldeviceId(){
        String serial = null;
        String m_szDevIDShort = "35" + 
                Build.BOARD.length()%10+ Build.BRAND.length()%10 +
                Build.CPU_ABI.length()%10 + Build.DEVICE.length()%10 +
                Build.DISPLAY.length()%10 + Build.HOST.length()%10 +
                Build.ID.length()%10 + Build.MANUFACTURER.length()%10 +
                Build.MODEL.length()%10 + Build.PRODUCT.length()%10 +
                Build.TAGS.length()%10 + Build.TYPE.length()%10 +
                Build.USER.length()%10 ; 

        try {
            serial = Build.class.getField("SERIAL").get(null).toString();
            return new UUID(m_szDevIDShort.hashCode(),serial.hashCode()).toString();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
            serial = "serial";
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
            serial = "serial";
        }
        return new UUID(m_szDevIDShort.hashCode(),serial.hashCode()).toString();
    }
}
